<template>
  <view class="container">
    <navigator :url="`/subpages/systemsg/systemsg`" hover-class="navigator-hover">
    <view class="msg-type-item">
      <view class="type-img">
          <u-avatar src="" size="50"></u-avatar>
      </view>
      <view class="type-info">
        <view class="type-title">
          系统消息
        </view>
        <view class="new-msg">
          {{ msgTip}}
        </view>
      </view>
    </view>
    </navigator>

  </view>
</template>

<script>
import {getSystemNoticeList} from "@/config/api";

export default {
  data() {
    return {
      total: 0,
      infoList: [],
      pageNum: 1,
      pageSize: 10,


    };
  },
  computed: {

    msgTip(){
      return this.infoList.length > 0 ?
          `存在 ${this.infoList.length} 条消息 ！`
          : '暂无系统消息'
    }

  },
  onPullDownRefresh() {
    console.log('refresh');
    // setTimeout(function () {
    //   uni.stopPullDownRefresh();
    // }, 1000);

    //请求房源信息列表
    getSystemNoticeList({
      pageNum: this.pageNum,
      pageSize: this.pageSize,
      orderByColumn: "create_time",
      isAsc: "desc"
    }).then(res => {
      this.infoList = res.rows;
      uni.stopPullDownRefresh();
    }).catch(err => {

    })

  },
  onLoad() {

    getSystemNoticeList({
      pageNum: this.pageNum,
      pageSize: this.pageSize,
      orderByColumn: "create_time",
      isAsc: "desc"
    }).then(res => {
      this.infoList = res.rows;
    }).catch(err => {

    })

  },
}
</script>

<style lang="scss">

.container{
  justify-content: unset;
  flex-direction: column;
  align-items: unset;

  .msg-type-item{
    display: flex;
    flex-direction: row;
    align-items: center;
    background-color: $sys-color-grey-242;
    padding: $sys-padding-30;
    padding-top: 40rpx;

    .type-img{
      margin-right: 30rpx;


    }
    .type-info{
      display: flex;
      flex-direction: column;

      .type-title{

      }

      .new-msg{
        font-size: 14px;
        margin-top: 30rpx;
        color: $sys-color-grey-170;
      }
    }
  }
}
</style>
